﻿<c:BaseControl x:Class="personalplaner.gui.stamm.views.FeiertageStamm"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:bs="clr-namespace:personalplaner.business.stamm;assembly=personalplaner.business"
             xmlns:vm="clr-namespace:personalplaner.common.mvvm.factory;assembly=personalplaner.common"
             xmlns:fac="clr-namespace:personalplaner.gui.stamm.viewmodels.factories"
             vm:ViewModelLoader.FactoryType="{x:Type fac:FeiertageStammModelFactory}"
             xmlns:c="clr-namespace:personalplaner.common.controls;assembly=personalplaner.common"
             xmlns:conv="clr-namespace:personalplaner.common.converters;assembly=personalplaner.common"
             xmlns:p="clr-namespace:personalplaner.gui.Properties" 
             Name="baseControl"
             Background="Transparent"
             Foreground="#E1000000">

    <Control.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/personalplaner.common;component/resources/styles/WhiteStyleTemplates.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Control.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="240"/>
            <ColumnDefinition Width="400"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <Border BorderBrush="Transparent" BorderThickness="0" Background="Transparent" Margin="5,5,5,0" Padding="5" >
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition />
                </Grid.RowDefinitions>

                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <TextBlock Text="Jahr" Margin="10,1,10,1"/>
                    <ComboBox Grid.Column="1" ItemsSource="{Binding Years}" SelectedItem="{Binding SelectedYear}"/>
                </Grid>

                <ListBox ItemsSource="{Binding Feiertage}" SelectedItem="{Binding SelectedFeiertag}" DisplayMemberPath="Name" Grid.Row="1" Margin="5,20,0,0"/>

            </Grid>
        </Border>

        <GridSplitter Width="4" Background="Transparent" />
        
        <GroupBox Margin="5,5,5,0" Grid.Column="1">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>

                <TextBlock Text="{x:Static p:Resources.Name}" Margin="0,0,20,0"/>
                <TextBox DataContext="{Binding SelectedFeiertag}" Text="{FocusBinding Name}" Grid.Column="1" IsEnabled="{Binding IsFeiertagSelected}"/>

                <TextBlock Text="{x:Static p:Resources.Date}" Margin="0,0,20,0" Grid.Row="1"/>
                <DatePicker SelectedDate="{Binding SelectedFeiertag.Von}" Grid.Row="1" Grid.Column="1" IsEnabled="{Binding IsFeiertagSelected}"/>

                <TextBlock Text="{x:Static p:Resources.BezahlteTage}" Margin="0,0,20,0" Grid.Row="2"/>
                <c:NumericTextBox Text="{Binding SelectedFeiertag.Tage, UpdateSourceTrigger=PropertyChanged}" Grid.Row="2" Grid.Column="1" Width="60" HorizontalAlignment="Left" IsEnabled="{Binding IsFeiertagSelected}"/>

            </Grid>
        </GroupBox>

        <StackPanel Grid.Row="1" Grid.ColumnSpan="4" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,20,40,20">
            <Button MinWidth="60" Margin="5" Command="{Binding DeleteCommand}">
                <TextBlock Text="{x:Static p:Resources.Delete}"/>
            </Button>
            <Button MinWidth="60" Margin="5" 
                    Command="{Binding NewCommand}">
                <TextBlock Text="{x:Static p:Resources.New}"/>
            </Button>
            <Button MinWidth="60" Margin="5"
                    Command="{Binding SaveCommand}">
                <TextBlock Text="{x:Static p:Resources.Save}"/>
            </Button>
            <Button MinWidth="60" Margin="5" IsDefault="True" 
                    Command="{Binding OkCommand}">
                <TextBlock Text="{x:Static p:Resources.Ok}"/>
            </Button>
            <Button MinWidth="60" Margin="5" IsCancel="True" 
                    Command="{Binding CancelCommand}">
                <TextBlock Text="{x:Static p:Resources.Cancel}"/>
            </Button>
        </StackPanel>
    </Grid>

</c:BaseControl>
